package com.c.ctgproject.customview;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;

import androidx.appcompat.app.AppCompatActivity;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.c.ctgproject.wiget.dialog.ShowImgVideoFragment;
import com.lwkandroid.widget.ninegridview.INineGridImageLoader;

/**
 * Created by LWK
 * 2016/12/5
 */
public class GlideImageLoader implements INineGridImageLoader
{
    @Override
    public void displayNineGridImage(Context context, String url, ImageView imageView)
    {
        Glide.with(context).load(url).into(imageView);
    }

    @Override
    public void displayNineGridImage(Context context, String url, ImageView imageView, int width, int height)
    {
        Glide.with(context).load(url)
                .apply(new RequestOptions().override(width, height))
                .into(imageView);
        imageView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ShowImgVideoFragment showImgVideoFragment=new ShowImgVideoFragment(url,false);
                AppCompatActivity activity= (AppCompatActivity) context;
                showImgVideoFragment.show(activity.getSupportFragmentManager(), "");
            }
        });
    }
}
